using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_portal_email_queue
    {
        public static DataTable SelectAll(int status)
        {
            try
            {
                usp_portal_email_queue_select_all entity = new usp_portal_email_queue_select_all();
                entity.STATUS = status;
                return BO_Actions<usp_portal_email_queue_select_all>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status)
        {
            try
            {
                usp_portal_email_queue_select_top entity = new usp_portal_email_queue_select_top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return BO_Actions<usp_portal_email_queue_select_top>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int queue_id)
        {
            try
            {
                usp_portal_email_queue_search entity = new usp_portal_email_queue_search();
                entity.QUEUE_ID = queue_id;

                return BO_Actions<usp_portal_email_queue_search>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
        {
            try
            {
                usp_portal_email_queue_select_paged entity = new usp_portal_email_queue_select_paged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return BO_Actions<usp_portal_email_queue_select_paged>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(string mail_title, string mail_content, int category_id, int region_id, int quota, int sent, bool is_finished, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status)
        {
            try
            {
                usp_portal_email_queue_insert entity = new usp_portal_email_queue_insert();
                entity.MAIL_TITLE = mail_title;
                entity.MAIL_CONTENT = mail_content;
                entity.CATEGORY_ID = category_id;
                entity.REGION_ID = region_id;
                entity.QUOTA = quota;
                entity.SENT = sent;
                entity.IS_FINISHED = is_finished;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return BO_Actions<usp_portal_email_queue_insert>.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(Int64 queue_id, string mail_title, string mail_content, int category_id, int region_id, int quota, int sent, bool is_finished, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status)
        {
            try
            {
                usp_portal_email_queue_update entity = new usp_portal_email_queue_update();
                entity.QUEUE_ID = queue_id;
                entity.MAIL_TITLE = mail_title;
                entity.MAIL_CONTENT = mail_content;
                entity.CATEGORY_ID = category_id;
                entity.REGION_ID = region_id;
                entity.QUOTA = quota;
                entity.SENT = sent;
                entity.IS_FINISHED = is_finished;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return BO_Actions<usp_portal_email_queue_update>.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(string ids, string spliter, int delete_type)
        {
            try
            {
                usp_portal_email_queue_delete entity = new usp_portal_email_queue_delete();
                entity.IDS = ids;
                entity.SPLITER = spliter;
                entity.DELETE_TYPE = delete_type;

                return BO_Actions<usp_portal_email_queue_delete>.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Restore(int queue_id)
        {
            try
            {
                usp_portal_email_queue_restore entity = new usp_portal_email_queue_restore();
                entity.QUEUE_ID = queue_id;

                return BO_Actions<usp_portal_email_queue_restore>.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int category_id, int region_id)
        {
            try
            {
                usp_portal_email_queue_select_admin entity = new usp_portal_email_queue_select_admin();
                entity.CATEGORY_ID = category_id;
                entity.REGION_ID = region_id;
                return BO_Actions<usp_portal_email_queue_select_admin>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

